#include "led.h"
#include "key.h"
#include "delay.h"
#include "w25q32.h"
#include <string.h>
#include "usart.h"
#include <stdio.h>

int main(void)
{
    // 初始化
    USART_Init();
	W25Q32_Init();

    printf("SPI soft program start\n");

	// 2. 读取ID进行测试
	uint8_t mid = 0;
	uint16_t did = 0;
	W25Q32_ReadID(&mid, &did);
	printf("mid = %#x, did = %#x\n", mid, did);

	// 4. 页写
	W25Q32_write(0x00, "12345678", 8);

	// 5. 读取
	uint8_t buffer[10] = {0};
	W25Q32_read(0x02, buffer, 6);

	printf("buffer = %s\n", buffer);

    while(1)
    {
        uint8_t ch = USART_ReceiveChar();
        USART_SendChar(ch);
    }
}
